/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cadbury;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

/**
 *
 * @author George
 */
public class Welcome extends JPanel {

    public Welcome() throws IOException, ClassNotFoundException {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                GUI();
            }
        });
        while (true) {
            BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("What would you like to do, sir?");
            String database = bf.readLine();
            Command newCommand = new Command(database);
        }


    }

    private static void GUI() {
        Dimension size = new Dimension();
        size = Toolkit.getDefaultToolkit().getScreenSize();
        JFrame frame = new JFrame("Cadbury");//Create and set up the window.
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        final Password pane = new Password(frame);//Create and set up the content pane.
        pane.setOpaque(true); //content panes must be opaque
        frame.setContentPane(pane);
        frame.addWindowListener(new WindowAdapter() {
            public void windowActivated(WindowEvent e) {
                pane.resetFocus();
            }
        });
        frame.setLocation((size.width / 2) - 100, 0);
        frame.pack();
        frame.setAlwaysOnTop(true);
        frame.setVisible(true);
    }
}
